package tex.base;

import java.util.Vector;

/*
 * coisas dentro de "{" e "}"
 */
public class Enviroment implements Element {
	private final Vector<Element> elements;
	private String name;
	private final Vector<String> opts;

	public Enviroment() {
		elements = new Vector<Element>();
		setName("");
		opts = new Vector<String>();
	}

	/**
	 * @return the elements
	 */
	public Vector<Element> getElements() {
		return elements;
	}

	@Override
	public String toString() {
		return "(env " + ((!getName().equals("")) ? getName() : "unidentified")
				+ ": " + elements.toString() + ")";
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the opts
	 */
	public Vector<String> getOpts() {
		return opts;
	}

	@Override
	public void generateDocument(StringBuffer buffer, Tex tex) {
		for (Element element : elements) {
			element.generateDocument(buffer, tex);
		}
	}
}
